var nums = [2,2,1,1,4,1,3,3]

var singleNumber = function (nums) {
    var flag = 0
  nums.forEach(e => {
      flag = e^flag
  });
  return flag
}

console.log(singleNumber(nums))